package fast;

import java.util.*;
import java.io.*;

/**
 * FilePath class
 * 
 * Reads in a .prop (properties) file, and sets a filepath based on the OS that
 * the process is currently running in. *
 * 
 * @author Adam Bell
 * @version 0.1
 * @date 20/03/2010
 */
public class FilePath {

	String filePath;

	/**
	 * Constructor
	 * 
	 * @throws FileNotFoundException
	 * @throws IOException
	 */
	public FilePath() throws FileNotFoundException, IOException {

		// prep the config file
		Properties fpp = new Properties();

		fpp.load(new FileInputStream("lib/filepath.prop"));

		if (System.getProperty("os.name").indexOf("Window") != -1) {
			this.filePath = fpp.getProperty("windows");
		} else if (System.getProperty("os.name").indexOf("Mac") != -1) {
			this.filePath = fpp.getProperty("mac");
		} else if (System.getProperty("os.name").indexOf("Linux") != -1) {
			this.filePath = fpp.getProperty("linux");
		} else {
			this.filePath = "fail!";
		}
	}

	/**
	 * Gets the currently set filepath
	 * 
	 * @return String filePath
	 */
	public String getFilePath() {
		return this.filePath;
	}
}
